package com.atguigu.yygh.hosp.controller.api;

import com.atguigu.yygh.common.utils.HttpRequestHelper;
import com.atguigu.yygh.hosp.result.Result;
import com.atguigu.yygh.hosp.service.ScheduleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/api/hosp")
public class ScheduleApiController {

    @Autowired
    ScheduleService scheduleService;

    /**
     * 添加排版信息-->已完成
     * @param request：HttpServletRequest request
     * @return ：Result
     */
    //http://localhost/api/hosp/saveSchedule
    @PostMapping("/saveSchedule")
    public Result saveSchedule(HttpServletRequest request){
        Result result = scheduleService.saveSchedule(request);
        return result;
    }

    //http://localhost/api/hosp/schedule/list

    /**
     * 排版查询
     * @param request：HttpServletRequest request
     * @return ：Result
     */
    @PostMapping("schedule/list")
    public Result getScheduleList(HttpServletRequest request){

        Result result = scheduleService.getScheduleList(request);
        return result;
    }


    //http://localhost/api/hosp/schedule/remove

    /**
     * 删除排版信息
     * @param request：HttpServletRequest request
     * @return ：Result
     */
    @PostMapping("schedule/remove")
    private Result removeSchedule(HttpServletRequest request){
        Result result = scheduleService.removeSchedule(request);
        return result;
    }
    //http://localhost/api/hosp/schedule/remove
}
